package plantshop.model;
import java.io.Serializable;


public class Location implements Serializable{

	private static final long serialVersionUID = -6889612942215620221L;
	
	private int x, y;
	
	public Location(int x, int y){
		if(x >= 0 && y >= 0){
			this.x = x;
			this.y = y;
		}
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj.getClass() == Location.class){
			Location loc = (Location)obj;
			
			if(loc.getX() != x)
				return false;
			if(loc.getY() != y)
				return false;
			
			return true;
		}
		return false;
	}
	
	public Location clone(){
		return new Location(x,y);
	}
	
	public String toString()
	{
		return "Location: x: " + x + " y: " + y;
	}
}
